<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/jsps/common/taglibs.jsp"%>

<!DOCTYPE html>
<html lang="en" class="body-full-height">
    <head>        
        <!-- META SECTION -->
        <title>登录</title>            
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        
        <link rel="icon" href="${pageContext.request.contextPath}/pics/favicon.ico" type="image/x-icon" />
        <!-- END META SECTION -->
        
        <!-- CSS INCLUDE -->        
        <link rel="stylesheet" type="text/css" id="theme" href="${pageContext.request.contextPath}/css/theme-default.css"/>
        <!-- EOF CSS INCLUDE -->

        <style>

            span{
                color: #FFFFFF;
            }

        </style>

    </head>
    <body>
        
        <div class="login-container">
        
            <div class="login-box animated fadeInDown">
                <div class="login-logo"></div>
                <div class="login-body">
                    <div class="login-title"><strong><fmt:message key="user.welcome"/></strong>, 请登录</div>
                    <form:form action="${pageContext.request.contextPath}/security/login" class="form-horizontal" method="post" modelAttribute="user">
                    <div class="form-group">
                        <div class="col-md-12">
                            <form:input path="userNo" class="form-control" placeholder="账号"/>
                            <form:errors path="userNo" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-12">
                            <form:password path="userPwd" class="form-control" placeholder="密码"/>
                            <form:errors path="userPwd" />
                        </div>
                    </div>
                    <font color="#ECEDEE">
                        <c:if test="${!empty userError}">
                            ${userError}
                        </c:if>
                    </font>
                    <div class="form-group">
                        <div class="col-md-12">
                            <font color="#EAECED">验证码：</font>
                            <input id="randomcode" name="randomcode" size="8" />
                            <img id="randomcode_img" src="${pageContext.request.contextPath}/validatecode.jsp" alt=""
                                    width="56" height="20" align='absMiddle' />
                            <a id="getImg" href="#">刷新</a></TD>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-offset-1 col-md-5">
                            <label class="col-md-12 checkbox">
                                <input type="checkbox" name="rememberMe"><font color="#ECEDEE">自动登录</font></input>
                            </label>
                        </div>
                        <div class="col-md-6">
                            <button id="login" class="btn btn-info btn-block">登录</button>
                        </div>
                    </div>
                    </form:form>
                </div>
                <div class="login-footer">
                    <div class="pull-left">
                        &copy; 2017 smirk - xiaoze
                    </div>
                    <div class="pull-right">
                        没有账号?<a id="register" href="#">    注册</a>
                    </div>
                </div>
            </div>
            
        </div>

        <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-3.1.1.min.js"></script>
        <script type="text/javascript">

            $(function(){

                $("#login").click(function () {
                    $("form").submit();
                    return false;
                });

                $("#register").click(function () {
                    var href="${pageContext.request.contextPath}/security/toRegister";
                    $(location).attr("href",href);
                });

                $("#getImg").click(function () {
                    $("#randomcode_img").attr("src","${pageContext.request.contextPath}/validatecode.jsp"+"?num="+Math.random());
                    return false;
                });

            });

        </script>
        
    </body>
</html>






